<template>
    <div class="main">
        <PageTitle title="提现详情"></PageTitle>
        <div class="con">
            <div class="item">
                <p>提现账号：</p>
                <p>{{item.card}}</p>
            </div>
            <div class="item">
                <p>提现金额：</p>
                <p>{{item.price}}</p>
            </div>
            <div class="item">
                <p>提现状态：</p>
                <p>{{item.state == 1?'打款中':'已打款'}}</p>
            </div>
            <div class="item">
                <p>打款凭证：</p>
                <p>
                    <Upload
                        :fileListArr="imgs"
                        :fileListName="'images'"
                        :fileMaxCount="1"
                        @fileChange="fileChange"
                    ></Upload>
                </p>
            </div>
        </div>
        <el-button type="primary" @click="submit">确定</el-button>
        <el-button @click="$router.go(-1)">取消</el-button>
    </div>
</template>
<script>
import PageTitle from "@/components/pageTitle/PageTitle.vue";
import Upload from '@/components/upload/Upload.vue'
export default {
    components:{
        PageTitle,
        Upload
    },
    data(){
        return{
            dialogVisible:false,
            dialogImageUrl:null,
            item:[],
            imgs:[]
        }
    },
    activated(){
        console.log('route-------',this.$route.params.items)
        this.$nextTick(function(){
            if (this.$route.params.items) {
                this.item = this.$route.params.items
                console.log('item----------',this.item.image)
                if (this.item.url) {
                    this.imgs=[{id:this.item.image,url:this.item.url}]
                }else{
                    this.imgs=[]
                }
                
            }else{
                this.$router.push('/userBalanceList')
            }
        })
    },
    created(){
        
        
    },
    mounted(){

    },
    methods:{
        //提交
        async submit(){
            console.log('imgs---------',this.imgs)
            let {data:{code,data}} = await this.$axios({
                url:this.$api + "/v1/carry/payment",
				method:"POST",
				data:{
                    id:this.item.id,
                    image:this.imgs[0].id
                }
            })
            if(code == 0) {
                this.$message({
                    type: 'success',
                    message: data
                })
                setTimeout(() => {
                    this.$router.go(-1)
                }, 2000)
            }
        },
        handlePictureCardPreview(src) {
            this.dialogImageUrl = src;
            this.dialogVisible = true;
        },
        fileChange(data) {
            console.log('图片data----------',data)
            this.imgs = data.arr
        },
    }
}
</script>
<style scoped>
    .main .item{
        border-bottom: 1px solid #efefef;
        width: 400px;
    }
</style>